﻿<Window x:Class="App_AerCloudDemo.BrowseDatabaseWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:views="clr-namespace:App_AerCloudDemo.GUI.Views"
        Title="AerCloud.net Demo - Database Browser" MinHeight="400" MinWidth="420" Width="800" Height="600">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="91*"/>
        </Grid.RowDefinitions>

        <DataGrid ItemsSource="{Binding Path=Items}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="True" 
                  Grid.Row="1" HorizontalGridLinesBrush="#FFB8B6B6" VerticalGridLinesBrush="#FFB8B6B6" >
            <DataGrid.Resources>
                <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="LightBlue" />
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="LightBlue" />
                <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="Black"/>
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
            </DataGrid.Resources>

            <DataGrid.Columns>
                <DataGridTemplateColumn Header="Tags" Width="100"  CanUserSort="True" SortMemberPath="Tags" IsReadOnly="True" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Tags}" Margin="4,0" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Name"  Width="Auto" CanUserSort="True" SortMemberPath="PersonName" IsReadOnly="True" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding PersonName}" Margin="4,0" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Image" Width="Auto" IsReadOnly="True">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <ListBox ItemsSource="{Binding Images}" BorderThickness="0">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Horizontal"/>
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>

                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Image Source="{Binding Source}"/>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
            <DataGrid.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Delete" Click="MenuDelete_Click" DataContext="{Binding RelativeSource={RelativeSource AncestorType=ContextMenu}, Path=PlacementTarget.SelectedItems}" />
                </ContextMenu>
            </DataGrid.ContextMenu>
        </DataGrid>

        <Label Name="lblLoading" FontSize="48" Grid.Row="0" Grid.RowSpan="2" Background="AliceBlue" Margin="0, 0, 0, 0" Content="Loading..." VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Cursor="Wait" />
    </Grid>
</Window>